package com.settlement.system.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.common.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
        import java.math.BigDecimal;
        import java.time.LocalDateTime;

/**
* <p>
* 有赞资金流水
* </p>
*
* @author huangrensen
* @since 2024-06-26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class YzFundFlow extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
    * ID
    */
    private String id;


    /**
    * 店铺ID
    */
    private Long storeId;
    @TableField(exist = false)
    private String storeName;


    /**
    * 店铺名称
    */
    private String yzStoreName;


    /**
    * 类型
    */
    private String billType;


    /**
    * 名称
    */
    private String productName;


    /**
    * 业务单号
    */
    private String businessNo;


    /**
    * 支付流水号
    */
    private String payFlowNo;


    /**
    * 关联单号
    */
    private String yzLinkNo;


    /**
    * 交易来源地
    */
    private String source;


    /**
    * 账务主体
    */
    private String accountName;


    /**
    * 账户类型
    */
    private String accountType;


    /**
    * 收入(元)
    */
    private BigDecimal incomeAmount;


    /**
    * 支出(元)
    */
    private BigDecimal payAmount;


    /**
    * 余额(元)
    */
    private BigDecimal balanceAmount;


    /**
    * 支付方式
    */
    private String payType;


    /**
    * 交易对手
    */
    private String otherName;


    /**
    * 渠道
    */
    private String channel;


    /**
    * 下单时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime orderTime;


    /**
    * 入账时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime billTime;
    @TableField(exist = false)
    private LocalDateTime startBillTime;
    @TableField(exist = false)
    private LocalDateTime endBillTime;


    /**
    * 操作人
    */
    private String operator;


    /**
    * 附加信息
    */
    private String otherMessage;


    /**
    * 备注
    */
    private String remark;

    /**
    * 来源
    */
    private String sourceText;

    @TableField(exist = false)
    private String tableName;
    @TableField(exist = false)
    private String billMonth;

    // 截取长度超出范围的字段
    public void cutString() {
        if (this.remark != null && this.remark.length() > 2000) {
            this.remark = this.remark.substring(0, 2000);
        }
    }

}
